package com.flashflexpro.flexdirector.model {

/**
 * abstract
 * 
 */
[Bindable]
[RemoteClass]
public class DtoActionRecording extends DtoAction{

    public function DtoActionRecording(){
        name = "Unnamed Recording action";
    }

    override public function getId():String{
        return getRecordingAppInst().getId() + getRecordingAppInst().recordings.getItemIndex( this );
    }

    public var recordingCreatedTime:uint;
    /**
     * the appInst when recording;
     * originAppInst + createTime can locate any original recorded action.
     */
    public function getRecordingAppInst():DtoAppInstRecording{
        return appInst as DtoAppInstRecording;
    }


    
    override public function copyInto ( parent:NameAndComment, newType:Class  ):NameAndComment {
        var rt:DtoActionReplay = super.copyInto ( parent, DtoActionReplay) as DtoActionReplay;
        if( getRecordingAppInst().correspondingReplayAppInst != null ){
            rt.appInst = getRecordingAppInst().correspondingReplayAppInst;
        }
        else{
            rt.appInst = new DtoAppInstReplay();
            rt.appInst.name = appInst.name;
            rt.appInst.viewColor = appInst.viewColor;
            rt.appInst.app = appInst.app;
            rt.appInst.params = appInst.params;
            rt.appInst.launchCommand = appInst.launchCommand;
            getRecordingAppInst().correspondingReplayAppInst = DtoAppInstReplay(rt.appInst);
        }
        return rt;
    }

}
}